﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using AteneoLibriBusinessLogic.Entities;

namespace AteneoLibri.AteneoLibriServices
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IAteneoLibriService" in both code and config file together.
    [ServiceContract]
    public interface IAteneoLibriService
    {
        #region Nation
        
        [OperationContract]
        List<Nation> getNations();

        [OperationContract]
        bool insertNation(Nation nation);

        [OperationContract]
        bool updateNation(Nation nation);

        [OperationContract]
        Nation getNation(Guid nationId);

        [OperationContract]
        bool deleteNation(Nation nation);

        #endregion

        #region City

        [OperationContract]
        List<City> getCities();

        [OperationContract]
        List<City> getCitiesByNationId(Guid nationId);

        [OperationContract]
        bool insertCity(City city);

        [OperationContract]
        bool updateCity(City city);

        [OperationContract]
        City getCity(Guid cityId);

        [OperationContract]
        bool deleteCity(City city);

        #endregion

        #region University

        [OperationContract]
        List<University> getUniversities();
       
        [OperationContract]
        List<University> getUniversityByCityId(Guid cityId);

        [OperationContract]
        University getUniversity(Guid universityId);

        [OperationContract]
        bool insertUniversity(University university);

        [OperationContract]
        bool updateUniversity(University university);

        [OperationContract]
        bool deleteUniversity(University university);

        #endregion

        #region Faculty
        [OperationContract]
        List<Faculty> getFacultiesByUniversity(Guid universityId);

        [OperationContract]
        Faculty getFaculty(Guid idFaculty);

        [OperationContract]
        bool insertFaculty(Faculty faculty); // new

        [OperationContract]
        bool updateFaculty(Faculty faculty); // new

        [OperationContract]
        bool deleteFaculty(Faculty faculty);

        #endregion

        #region Book

        [OperationContract]
        List<Book> getBooks();

        [OperationContract]
        Book getBookById(Guid idBook);

        [OperationContract]
        List<Book> getBooksByIdUser(Guid userId);

        [OperationContract]
        bool insertBook(Book book);

        [OperationContract]
        User getUserByIdBook(Guid bookId);

        [OperationContract]
        bool updateBook(Book book);

        [OperationContract]
        bool deleteBooks(Guid userId);

        [OperationContract]
        bool deleteBook(Guid bookId);

        #endregion

        #region Users

        [OperationContract]
        List<User> getUsers();
       
        [OperationContract]
        bool CheckExistingRegistration(string email);

        [OperationContract]
        bool UserNameExist(string username);

        [OperationContract]
        User getUserByEmailAndPsw(string email, string password);

        [OperationContract]
        User getUserByEmail(string email);

        [OperationContract]
        User getUserById(Guid idUser);

        [OperationContract]
        bool insertUser(User user);

        [OperationContract]
        bool modifyUserAccessDate(User user);

        [OperationContract]
        bool updatePassword(User user);

        [OperationContract]
        bool updateUser(User user);

        [OperationContract]
        List<User> getUsersByUniversityId(Guid universityId);

        [OperationContract]
        bool deleteUser(Guid userId);

        #endregion

        #region Books
        //[OperationContract]
        //ObservableCollection<Book> getBooksByTitle(String title);

        //[OperationContract]
        //ObservableCollection<Book> getBooksByAuthors(String author);        

        #endregion

        #region Sales
        [OperationContract]
        List<Sale> getSalesByBookId(Guid bookId);

        [OperationContract]
        List<Sale> getSalesByUserId(Guid userId);

        [OperationContract]
        Book getBookByIdSale(Guid idSale);

        [OperationContract]
        List<Sale> getSales();

        [OperationContract]
        User getUserIdByIdSale(Guid idSale);

        [OperationContract]
        bool insertSale(Sale sale);

        [OperationContract]
        bool existPreviousRequest(Guid userId, Guid bookId);

        [OperationContract]
        bool updateSaleStatus(Sale sale, Guid saleStatusId);

        [OperationContract]
        bool setEndDate(Sale sale, DateTime endDate);

        [OperationContract]
        bool updateSale(Sale sale);

        [OperationContract]
        bool deleteSales(Guid userId);

        #endregion

        #region Messages

        [OperationContract]
        List<Message> getMessagesBetweenSellerPurchaser(Guid sellerId, Guid purchaserId);

        [OperationContract]
        bool insertMessage(Message message);

        [OperationContract]
        bool deleteMessages(Guid userId);

        #endregion

        #region RecoveryCode

        [OperationContract]
        bool insertRecoveryRow(RecoveryCode recovery);

        [OperationContract]
        Guid getUserByRecoveryCode(string recoveryCode);

        [OperationContract]
        bool deleteRecoveryCode(Guid userId);

        #endregion
    }
}
